<template>
  <el-dialog
    :title="$language.local('签约率设置')"
    :visible.sync="model"
    width="40%"
  >
    <el-form
      ref="formRef"
      :model="formData"
      :rules="$rules"
      label-width="100px"
      status-icon
    >
      <template v-for="(item, key) in formDataKeys">
        <template v-if="key == 'authorizeSID'">
          <el-form-item :key="key" :label="$language.local(key)">
            <xy-input v-model="formData[key]"></xy-input>
          </el-form-item>
        </template>
        <el-form-item :key="key" v-else :label="$language.local(key)">
          <xy-input v-model="formData[key]"></xy-input>
        </el-form-item>
      </template>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">{{
        $language.local("取消")
      }}</el-button>
      <el-button type="primary" @click="onSubmit('formRef')">{{
        $language.local("确定")
      }}</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  props: {
    model: Object,
    api: String,
  },
  data() {
    return {
      dialogVisible: false,
      formData: "",
      formDataKeys: "",
    };
  },
  methods: {
    async onSubmit(formName) {
      console.log(this.formData);
      let res = await this.$refs[formName].validate();
      if (!res) {
        return;
      }
    },
  },
};
</script>

<style></style>
